
import { ElMessageBox, ElMessage } from 'element-plus';

const messageFun = async(titleMsg: string) => {
    const { value } = await ElMessageBox.prompt('',titleMsg,{
        inputType: 'textarea',
        showCancelButton: true,
        confirmButtonText: '确定',
        cancelButtonText: '取消',
    } as any);
    if(value !== null){
        return value;
    }else{
        console.log('用户取消了')
    }
}
/**
 * @description
 * @author ZhangYu
 * @date 02-02-2024
 * @param {string} conMsg 内容信息
 * @param {string} headeMsg 标题信息
 * @param {(string | any)} iconMsg 图标信息
 * @param {string} hintMsg 提示信息
 */
const confirmFun = (conMsg: string, headeMsg: string, iconMsg: string | any, hintMsg: string) => {
   return new Promise<boolean>((resolve, reject) => {
        ElMessageBox.confirm(conMsg,headeMsg,{
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: iconMsg
        }).then(() => {
            resolve(true);
        }).catch(() => {
            ElMessage({
                type: 'info',
                message: hintMsg
            });
            reject(false);
        });
   });
}
export { messageFun , confirmFun };
